from locust import HttpUser, task, between
import pandas as pd

# Load the Excel file into a DataFrame without specifying column names
df = pd.read_excel('data.xlsx', sheet_name=0, header=None)  # Assuming the data is in the first sheet and has no header row

class ApiUser(HttpUser):
    wait_time = between(1, 5)

    @task
    def post_request(self):
        # Iterate over each row in the DataFrame
        for index, row in df.iterrows():
            query = row[0]  # First column as query
            # documents = [row[1], row[2], row[3]]  # Second, third, and fourth columns as documents

            payload = {
                "model": "31-2-bge-large-zh-v1.5",
                "input": query,
                # "documents": documents
            }

            self.client.post("/v1/embeddings", json=payload)



